package com.chixing;

import java.sql.Connection;

public class ConnThread {
    private Mypool mypool;
    public ConnThread(Mypool mypool) {
        this.mypool = mypool;
    }
    public void run() {
        Connection conn = mypool.getConnection();
        System.out.println("线程" + Thread.currentThread().getName() + "获取连接成功！");
        try {
            Thread.sleep(5);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        try {
            conn.close();
            System.out.println("线程" + Thread.currentThread().getName() + "释放连接成功！");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
